package com.qf.util;

import com.github.pagehelper.PageHelper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Properties;

/**
 * 2019/12/6
 * Administrator
 * springboot1204
 * 面向对象面向君  不负代码不负卿
 */
@Configuration
public class PageUtil {

    //等价于在mybatis.xml文件中设置的分页插件
    @Bean   //方法名自定义四
    public PageHelper pg(){
        PageHelper pageHelper = new PageHelper();

        Properties properties = new Properties();//设置分页的相关属性
        //指定分页信息
        properties.setProperty("offsetAsPageNum","true");
        properties.setProperty("rowBoundsWithCount","true");
        properties.setProperty("reasonable","true");
        pageHelper.setProperties(properties);
        return pageHelper;
    }
}
